@extends('admin.layout.layout')
@section('title','轮播图显示')
@section('con')
        <div id="page-wrapper">
            <div class="row">
                <div ass="col-lg-12">
                    <h1 class="page-header">
                   @section('head')     
                    轮播图列表
                    @show


                    </h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            轮播图列表
                        </div>
                        <!-- /.panel-heading -->
                        
                        <div class="panel-body">
                            <div class="dataTable_wrapper">
                                 <div id="dataTables-example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                                    <div class="row">
                        
                                <div class="row"><div class="col-sm-12"><table id="dataTables-example" class="table table-striped table-bordered table-hover dataTable no-footer" role="grid" aria-describedby="dataTables-example_info">
                                    <thead>
                                        <tr role="row">
                                        <th>轮播图id</th>
                                        <th>轮播图名</th>
                                        
                                        <th>图片</th>
                                        <th>操作</th></tr>
                                    </thead>
                                    <tbody>
                                     @foreach($rotates as $k=>$v)                                       
                                    <tr class="gradeA odd" role="row">
                                            
                                            <td class="center sorting_1">{{$v->rid}}</td>
                                            <td class="center">{{$v->rname}}</td>
                                            <td class="center"><img src="{{asset($v->rpic)}}" width='100px' ></td>

                                            <td class="center"><button class='btn btn-danger btn-sm delete-btn' >删除</button></td>
                                        
                                        
                                        </tr>
                                    @endforeach

                                        </tbody>
                                </table>
                                </div>
                                    
        
                                </div>

                            <!-- /.table-responsive -->
                            
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
          
            <!-- /.row -->
           
            <!-- /.row -->
        </div>
 @endsection

 @section('js')
<script type="text/javascript">
    
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
});
        //获取删除标签
         var btn = $('.delete-btn');
         btn.click(function()
         {
            //获取当前的id
            var id =$(this).parents('tr').find('.sorting_1').html();
            //发送ajax
            // alert(uid);
            var opp = $(this);
           $.post('/admin/rotate/delete',{uid:id},function(data){
            // alert(data);
                if(data){
                    alert('删除成功');
                    opp.parents('tr').remove();

                }else{
                    alert('删除失败');
                }
           });
         // alert(id);
         // return false;
         }) 

</script>
 @endsection
                      